package view;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;

import command.ICommand;

@SuppressWarnings("serial")
public class ChatButton extends JButton {
	
	public ChatButton(String name, ICommand cmd)
	{		
		super(name);
		this.addActionListener( new BListener(cmd) );
	}
	
	private class BListener implements ActionListener {
		protected ICommand cmd;
		
		public BListener(ICommand cmd)
		{
			this.cmd = cmd;
		}
		
		public void actionPerformed(ActionEvent e)
		{
			cmd.execute();
		}
	}
}